package com.heima.demo;

import java.io.IOException;
import java.net.*;
import java.util.Scanner;

public class Demo2 {
    public static void main(String[] args) throws IOException {
        //1.找码头
        DatagramSocket ds = new DatagramSocket();
        //2打包礼物
        //DatagramPacket?(byte[] buf, int length, InetAddress address, int port)
        Scanner sc = new Scanner(System.in);
        while (true) {
            String s = sc.nextLine();
            if ("886".equals(s)) {
                break;
            }
            byte[] bytes = s.getBytes();
            InetAddress address = InetAddress.getByName("255.255.255.255");
            int port = 10000;
            DatagramPacket dp = new DatagramPacket(bytes, bytes.length, address, 10000);
            ds.send(dp);
        }
        ds.close();
    }
}
